package com.zp.qualitypractice.mvp3;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by izp on 2017/6/1.
 */

public class MainFragment extends BaseFragment {
    private MainContract.Presenter mPresenter;
    public static MainFragment newInstance(Bundle args) {
        MainFragment fragment = new MainFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void setPresenter(MainContract.Presenter presenter) {
        mPresenter = presenter;
    }

    @Override
    public void querySuccess(List<Object> list) {

    }

    @Override
    public void shareUsers(int count) {

    }

    @Override
    public void queryFail(Error e) {

    }

    @Override
    public void queryTotalMoneySuccess(double totalCost, double totalIncome) {

    }

    @Override
    public void queryTotalMoneyFail(Error e) {

    }

    @Override
    public void deleteSuccess() {

    }

    @Override
    public void deleteFail(Error e) {

    }

    @Override
    public void showOperateAccountDialog(Object account) {

    }

    @Override
    public void showDeleteAccountDialog(Object account) {

    }

    @Override
    public View getLayout(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return null;
    }

    /**
     * @param savedInstanceState
     * 是做baseFragment的时候在onActivityCreate的时候执行的
     */
    @Override
    public void onCreateFragment(@Nullable Bundle savedInstanceState) {
        initHeadView();
        initAdapter();

        Bundle arguments = getArguments();
        if (arguments != null) {
//            mStartDate = arguments.getString(AppConstants.EXTRA_POSITION);
//            mEndDate = DateUtils.getDateNxtMonth(mStartDate, DateUtils.FORMAT_MAIN_TAB, 1);
//            onRefresh();
        }
    }
    private void initHeadView() {
//        mHeadView = LayoutInflater.from(mContext).inflate(R.layout.rlv_header_main, null);
//        mTxtTotalCost = (TextView) mHeadView.findViewById(R.id.txt_total_cost);
//        mTxtTotalIncome = (TextView) mHeadView.findViewById(R.id.txt_total_income);
    }

    private void initAdapter() {
//        mRefreshLayout.setOnRefreshListener(this);
//        mRefreshLayout.setColorSchemeResources(R.color.colorAccent);
//        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
//        mAdapter = new AccountListAdapter(new ArrayList<Account>());
//        mAdapter.setHeaderView(mHeadView);
//        mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
//        mAdapter.setEmptyView(UiUtils.getEmptyView(mContext, mRecyclerView
//                , UiUtils.getString(R.string.empty_account_data)));
//        mAdapter.setOnLoadMoreListener(this, mRecyclerView);
//        mRecyclerView.setAdapter(mAdapter);
//        mRecyclerView.addOnItemTouchListener(new OnSimpleClickListener(){
//            @Override
//            public void onItemLongClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
//                Account account = (Account) baseQuickAdapter.getData().get(i);
//                showOperateAccountDialog(account);
//            }
//        });
    }

}
